package com.funong.matrix.biz.power.facade.impl;

import com.funong.matrix.biz.base.entity.SysRoleEntity;
import com.funong.matrix.biz.power.domain.SysRoleUserDomainDao;
import com.funong.matrix.biz.power.facade.SysRoleUserFacade;
import com.funong.matrix.biz.power.pojo.dto.SysRoleUserDTO;
import com.funong.matrix.biz.base.entity.SysRoleUserEntity;
import com.funong.matrix.core.dto.QueryDTO;
import com.funong.matrix.core.dto.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRoleUserFacadeImpl implements SysRoleUserFacade {
    @Autowired
    private SysRoleUserDomainDao sysRoleUserDomainDao;

    @Override
    public SysRoleUserDTO queryRoleUserByUserId(Integer userId) {
        return sysRoleUserDomainDao.queryRolesByUserId(userId);
    }

    @Override
    public void saveUserRole(SysRoleUserDTO sysRoleUserDTO) {
        sysRoleUserDomainDao.saveUserRole(sysRoleUserDTO);
    }

    @Override
    public List<SysRoleUserEntity> queryByUserId(Integer userId) {
        return sysRoleUserDomainDao.queryByUserId(userId);
    }

    @Override
    public List<SysRoleUserEntity> queryByRoleCode(String roleCode) {
        return sysRoleUserDomainDao.queryByRoleCode(roleCode);
    }

    @Override
    public List<Integer> queryUsersByRoleCode(String roleCode) {
        return sysRoleUserDomainDao.queryUsersByRoleCode(roleCode);
    }



    @Override
    public Result<List<SysRoleEntity>> queryRoleList(QueryDTO<SysRoleEntity> roleQO) {
        return sysRoleUserDomainDao.queryRoleList(roleQO);
    }

    @Override
    public Boolean saveRole(SysRoleEntity sysRoleEntity) {
        return sysRoleUserDomainDao.saveRole(sysRoleEntity);
    }

    @Override
    public Boolean deleteRole(SysRoleEntity sysRoleEntity) {
        return sysRoleUserDomainDao.deleteRole(sysRoleEntity);
    }

    @Override
    public Boolean updateRole(SysRoleEntity sysRoleEntity) {
        return sysRoleUserDomainDao.updateRole(sysRoleEntity);
    }

    @Override
    public Boolean updateRoleStatus(SysRoleEntity sysRoleEntity) {
        return sysRoleUserDomainDao.updateRoleStatus(sysRoleEntity);
    }
}
